home *** CD-ROM | disk | FTP | other *** search
- // AbClassy.prg
- //
- // Specification and implementation of array browsing
- // class using Class(y).
-
- #include "Class(Y).ch"
-
- CREATE CLASS arrayBrowse FROM TBrowse
-
- EXPORT:
- VAR arrayIndex
- VAR arrayReference
-
- METHOD Init
-
- END CLASS
-
-
- // Extra set of parens ensures parent constructor gets invoked
- METHOD Init(), ()
-
- ::arrayIndex := 1
- ::goTopBlock := {|| ::arrayIndex := 1 }
- ::goBottomBlock := {|| ::arrayIndex := Len(::arrayReference) }
-
- // Standard array skipper
- ::skipBlock := {|nToSkip, nTemp| ;
- nTemp := ::arrayIndex, ;
- ::arrayIndex := ;
- iif(nToSkip > 0, ;
- Min(::arrayIndex + nToSkip, ;
- Len(::arrayReference)), ;
- Max(1, ::arrayIndex + nToSkip)), ;
- ::arrayIndex - nTemp ;
- }
-
- RETURN Self